package ED2;

import java.util.Arrays;

public class AlunoBean 
{
    private int rm;
    private int[] vizinhoRm;
    
    public AlunoBean(){
    this(-1, new int[]{});
    }
    
    public AlunoBean(int rm){
    this(rm, new int[]{});
    }
    
    public AlunoBean(int rm, int[] vizinhoRm){
    this.rm = rm;
    this.vizinhoRm = vizinhoRm;
    }
    
    public int getRm(){
    return rm;
    }
    
    public void setRm(int rm){
    this.rm = rm;
    }
    
    public int[] getvizinhoRm(){
    return vizinhoRm;
    }
    
    public void setvizinhoRm(int[] vizinhoRm){
    this.vizinhoRm = vizinhoRm;
    }
    
    @Override
    public boolean equals(Object object)
    {
        if(object instanceof AlunoBean)
        {
            AlunoBean aluno = (AlunoBean) object;
            
            if(aluno.getRm() == rm && Arrays.equals(aluno.getvizinhoRm(), vizinhoRm)){
                return true;
            }
            else{
                return false;
            }
        }
        else{
            return false;
        }
    }

    @Override
    public int hashCode() {
        int hash = 5;
        
        hash = 53 * hash + rm;
        hash = 53 * hash + Arrays.hashCode(vizinhoRm);
        
        return hash;
    }
    
    @Override
    public String toString()
    {
        String rm = String.valueOf(getRm());
        int needMore = 5 - rm.length();
        
        if(needMore > 0)
        {
            for(int i = 0; i < needMore; i++)
            {
                rm = "0" + rm;
             }
        }
        
        return rm;
    }
}
